﻿using AutoMapper;
using PLC.Domain.Dto;
using PLC.Domain.Entity;

namespace PLC.Infrastructure.AutoMapper;

public class DataConfigConfig:Profile
{
    public DataConfigConfig()
    {
        CreateMap<DtoDataConfig, DataConfig>()
            .ForMember(dest => dest.Id, source => source.MapFrom(p => p.id))
            .AfterMap((source, dest) =>
            {
                dest.SetDataDescription(source.DataDescriptionList);
            })
            .ReverseMap()
            .AfterMap((source, dest) =>
            {
                dest.SetDataDescriptionList(source.DataDescription);
            });


        //CreateMap<DataConfig, DtoDataConfig>()
        //    .ForMember(dest => dest.id, source => source.MapFrom(p => p.Id))
        //    .AfterMap((source, dest) =>
        //    {
        //        dest.SetDataDescriptionList(source.DataDescription);
        //    });
    }
}